export const formatDate=(value,type=0)=>{
  var date = new Date(value);
  var y = date.getFullYear(),
    m = date.getMonth() + 1,
    d = date.getDate(),
    h = date.getHours(),
    i = date.getMinutes(),
    s = date.getSeconds();
  if (m < 10) { m = '0' + m; }
  if (d < 10) { d = '0' + d; }
  if (h < 10) { h = '0' + h; }
  if (i < 10) { i = '0' + i; }
  if (s < 10) { s = '0' + s; }
  var t = y + '-' + m + '-' + d 
	if(type==1){
		if(Date.now()-value<60000){
			return '刚刚'
		}
		if(Date.now()-value>60000 && Date.now()-value<3600000){
				let newm=Math.floor((Date.now()-value)/1000/60)
			
			return newm+'分钟前'
		}
		if(Date.now()-value>60000 && Date.now()-value<86400000){
			let newh=Math.floor((Date.now()-value)/1000/60/60)
			
			return newh+'小时前'
		}
		if(Date.now()-value>86400000 && Date.now()-value<604800000){
			let newd=Math.floor((Date.now()-value)/1000/60/60/24)
			
			return newd+'天前'
		}
		if(Date.now()-value>604800000){
			return t;
		}
	}else{
		return t;
	}
	
}
	